﻿<UserControl x:Class="LFSRecord2.View.TimelineLayerInfoView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:lfsv="clr-namespace:LFSRecord2.View"
             xmlns:lfsconv="clr-namespace:LFSRecord2.View.Converters"
             xmlns:lfsstruct="clr-namespace:LFSRecord2.View.TimelineStructures"
             mc:Ignorable="d" Loaded="UserControl_Loaded"
             d:DesignHeight="168" d:DesignWidth="225"
             Width="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ItemsControl}}, Path=ActualWidth}"
             MouseRightButtonDown="UserControl_MouseRightButtonDown">
    <UserControl.Resources>
        <lfsconv:LabelSelectionBackgroundBrushConverter x:Key="labelSelectionBackgroundBrushConverter" />
        <lfsconv:LabelSelectionForegroundBrushConverter x:Key="labelSelectionForegroundBrushConverter" />
        <lfsconv:IsCollapsedVisibilityConverter x:Key="isCollapsedVisibilityConverter" />
        <lfsconv:LayerCollapseImageConverter x:Key="layerCollapseImageConverter" />
        <lfsconv:IsActiveCameraVisibilityConverter x:Key="isActiveCameraVisibilityConverter" />
        <BitmapImage x:Key="ColCollapsed" UriSource="pack://application:,,,/data/bitmaps/icons/CollapseIconCollapsed.png" />
        <BitmapImage x:Key="ColExpanded" UriSource="pack://application:,,,/data/bitmaps/icons/CollapseIconExpanded.png" />
        <BitmapImage x:Key="CameraIcon" UriSource="pack://application:,,,/data/bitmaps/icons/Camera.png" />
    </UserControl.Resources>
    <Grid>
        <StackPanel Orientation="Vertical">
            <Grid Height="17" Background="#FF555555">
                <Image Name="CollapseImage" Margin="4,0,4,0" 
                       Source="{Binding IsCollapsed, Converter={StaticResource layerCollapseImageConverter}}" 
                       Stretch="None" 
                       HorizontalAlignment="Left" 
                       MouseLeftButtonDown="CollapseImage_MouseLeftButtonDown" />
                <StackPanel Name="LayerNameSelectionBackground" 
                            Width="160" Height="14"
                            Orientation="Horizontal"
                            Margin="15,0,0,0"
                            Background="{Binding IsSelected, Converter={StaticResource labelSelectionBackgroundBrushConverter}}"
                            HorizontalAlignment="Left"
                            MouseLeftButtonDown="LayerNameLabel_MouseLeftButtonDown"
                            MouseRightButtonDown="LayerNameLabel_MouseLeftButtonDown">
                    <TextBlock Name="LayerNameLabel" 
                           Margin="1,-1,0,0" Padding="0" 
                           Text="{Binding LayerName}" 
                           Foreground="{Binding IsSelected, Converter={StaticResource labelSelectionForegroundBrushConverter}}" 
                           FontWeight="Bold" FontStyle="Italic" 
                           HorizontalAlignment="Left" IsHitTestVisible="False" />
                    <Image Name="CameraIcon" Margin="4,0,2,0" 
                       Source="{StaticResource CameraIcon}" 
                       Stretch="None" Width="16" Height="10"
                       HorizontalAlignment="Left" SnapsToDevicePixels="True"
                       Visibility="{Binding IsActiveCamera, Converter={StaticResource isActiveCameraVisibilityConverter}}" 
                       ToolTip="Active Camera" />
                </StackPanel>
                <TextBox Name="LayerRenameBox" 
                         Width="160" Height="17" 
                         Margin="15,0,0,0" Padding="0,-2,0,-1"
                         HorizontalAlignment="Left" 
                         MaxLength="23"
                         Visibility="Collapsed" />
                <lfsstruct:ParentLayerSelectionControl x:Name="LayerBindingControl" DataContext="{Binding}" Margin="0,3,3,0" HorizontalAlignment="Right" VerticalAlignment="Top" />
            </Grid>
            
            <Line X1="0" X2="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=Width}"
                  Y1="0.5" Y2="0.5"
                  Stroke="#FF606060"
                  StrokeThickness="1"
                  IsHitTestVisible="False" />

            <ItemsControl Name="PropertyItemsControl" 
                          ItemsSource="{Binding Properties}" 
                          Focusable="False" 
                          Visibility="{Binding IsCollapsed, Converter={StaticResource isCollapsedVisibilityConverter}, Mode=TwoWay}">
                <ItemsControl.ItemTemplate>
                    <DataTemplate>
                        <StackPanel Orientation="Horizontal" Width="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Grid}}, Path=ActualWidth}">
                            <lfsv:TimelineLayerPropertyView DataContext="{Binding}" Background="#FF6A6A6A" />
                        </StackPanel>
                    </DataTemplate>
                </ItemsControl.ItemTemplate>
            </ItemsControl>

        </StackPanel>
    </Grid>
</UserControl>
